<template lang="pug">
  keep-alive
    kalix-table(bizKey="liveRooms" title='直播列表' ref="kalixTable"
    v-bind:tableFields="tableFields"
    v-bind:targetURL="liveRoomsURL"
    v-bind:bizDialog="liveRoomsDialog"
    v-bind:btnList="liveRoomsBtnList"
    v-bind:toolbarBtnList="toolbarBtnList"
    bizSearch="liveRoomsSearch")
</template>

<script type="text/ecmascript-6">
  import {LiveRoomsURL} from '../../config.toml'
  import {liveRoomsConfigBtnList} from './config'
  import KalixTable from '../../../../../components/corelib/components/common/baseTable'

  export default {
    name: 'kalix-training-liveroomlist',
    components: {KalixTable},
    data() {
      // var validateGenealogyname = (rule, value, callback) => {
      //   if (value !== undefined && value !== null && value !== '') {
      //     let valTrim = value.replace(/^\s+|\s+$/g, '')
      //     let reg = /^[\u4e00-\u9fa5_a-zA-Z]+$/
      //     if (reg.test(valTrim)) {
      //       callback()
      //     } else {
      //       callback(new Error('请输入正确家谱名称'))
      //     }
      //   } else {
      //     callback(new Error('请输入家谱名称'))
      //   }
      // }
      return {
        liveRoomsURL: LiveRoomsURL,
        // rules: {
        //   liveUrl: [{required: true, validator: validateGenealogyname, trigger: 'blur'}]
        // },
        tableFields: [
          {prop: 'liveUrl', label: '直播流地址'},
          {prop: 'liveId', label: '直播间ID'},
          {prop: 'liveName', label: '直播间名称'},
          {prop: 'num', label: '直播间位置'},
          {prop: 'userId', label: '用户ID'},
          {prop: 'examine', label: '审核状态'}
        ],
        liveRoomsDialog: [
          {id: 'add', dialog: 'LiveRoomsAdd'},
          {id: 'edit', dialog: 'LiveRoomsEdit'},
          {id: 'delete', dialog: 'LiveRoomsDelete'},
          {id: 'view', dialog: 'LiveRoomsView'}
        ],
        liveRoomsBtnList: liveRoomsConfigBtnList,
        toolbarBtnList: [
          {id: 'add', isShow: true, title: '添加', icon: 'icon-pinleizengjia', isPermission: true}
        ]
      }
    }
  }
</script>

<style scoped lang="stylus">

</style>
